package operator;

import book.Book;
import book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: HP
 * Date: 2023 -03 -26
 * Time: 20:54
 */
public class AddOperator implements Operator{
    @Override
    public void process(BookList booklist) {
        //添加图书重写
        Scanner sc=new Scanner(System.in);
        System.out.print("请输入书名");
        String name=sc.nextLine();
        System.out.print("请输入作者");
        String author=sc.nextLine();
        System.out.print("请输入价格");
        int price=sc.nextInt();
        System.out.print("请输入类型");
        String type=sc.nextLine();
        Book book=new Book(name,author,price,type);
        booklist.setBooks(booklist.getSize(), book);
        booklist.setSize(booklist.getSize()+1);
        System.out.println("add book "+name+" success!");
    }
}
